package com.bianmaba;

import com.bianmaba.services.datacollection.quartiz.QuartzTaskManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @program: samples
 * @description:
 * @author: Chenjiabin
 * @create: 2019/9/9 15:48
 **/
@SpringBootApplication
//目前没发现这个注解有啥用，不注解也可以正常使用系统缓存及hibernate二级缓存，感觉没有开启功能而只是配置功能
@EnableCaching()
public class DataCollectionServerApplication {

    @Autowired
    private QuartzTaskManager executor;

    public static void main(String[] args) {
        SpringApplication.run(DataCollectionServerApplication.class, args);
    }


    @Bean
    @ConditionalOnMissingBean(ExecutorService.class)
    public ExecutorService executorService() {
        ExecutorService executorService = Executors.newCachedThreadPool();
        return executorService;
    }
}